var child;
var isRed;
/**
 * layui主体代码
 */
layui.use(['form', 'laydate'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.$,
        laydate = layui.laydate;

    /**
     * 监听提交
     */
    form.on('submit(saveBtn)', function (data) {
        child = data.field;
        var data = data.field;
        var updateid= $("#id").val();
        console.log("id" + updateid);
        console.log(data);
        $.post("checkHealth/update",{
            classRoomName: data.classRoomName,
            className:data.className,
            studentName:data.studentName,
            id:updateid,
            istop: data.isTop,
            floorhealth: data.floorHealth,
            desktophealth:data.desktopHealth,
            areahealth: data.areaHealth,
            cabinethealth:data.cabinetHealth,
            checktime:new Date(data.beginTime),
            score: data.score,
            isred: $("#red").text() == "标红" ? 1 : 0

        },function (result) {
            close(result,$("#red").text() == "标红" ? 1 : 0);
        })

        return false;
    });
    /**
     * 时间选择框样式
     */
    laydate.render({
        elem: '#begin'
        , theme: '#393D49'
    });
});
/**
 * 子向父传值方法
 * @param result
 */
function close(result,isRed) {
    console.log(result)
    parent.parentPage(result, child,isRed);
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}